package com.xdb.sqlparser.ast.statement;

import java.util.ArrayList;
import java.util.List;

import com.xdb.sqlparser.ast.SQLName;
import com.xdb.sqlparser.ast.AbstractSQLObjectImpl;
import com.xdb.sqlparser.parser.SQLToken;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class SQLAlterTableAddIndex extends AbstractSQLObjectImpl implements SQLAlterTableItem {

	private boolean unique;

	private SQLName name;

	private final List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();

	private String type;

	private String using;

	private String keyOrIndex = SQLToken.INDEX.name;

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, getName());
			acceptChild(visitor, getItems());
		}
		visitor.endVisit(this);
	}

	public boolean isUnique() {
		return unique;
	}

	public void setUnique(boolean unique) {
		this.unique = unique;
	}

	public List<SQLSelectOrderByItem> getItems() {
		return items;
	}

	public SQLName getName() {
		return name;
	}

	public void setName(SQLName name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUsing() {
		return using;
	}

	public void setUsing(String using) {
		this.using = using;
	}

	public String getKeyOrIndex() {
		return keyOrIndex;
	}

	public void setKeyOrIndex(String keyOrIndex) {
		this.keyOrIndex = keyOrIndex;
	}
}
